Support materialized views in get_columns_in_relation
#9433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #9419
Important
The contents of this PR should be compared with #7459 since they both touch on the same code and could easily overwrite each other. Ideally, both of them will functional tests so that one doesn't undo the other by accident.
Problem
As described in #9419 (comment), the
information_schema.columns
view in postgres includes these:But it does not include:
Solution
Two things:
information_schema.columns
view into dbt-postgres.'m'::"char"
to the definition so that MVs are included.Definition of the
information_schema.columns
viewTo get the full text definition of this view, run the following:
The output is a fairly gnarly query as seen in 531446e
To do
After a quick search, I couldn't find any relevant tests for
adapter.get_columns_in_relation
, so we'll probably want some that cover all the different types of relations:The tests would basically just need to:
adapter.get_columns_in_relation
.I'm assuming that ephemeral will either raise an exception or return nothing, but we'll want to add applicable tests either way.
Checklist